package org.osomit.sacct.security.context.impl;

import org.osomit.sacct.security.context.iface.SecurityContextHolder;
import org.osomit.sacct.security.context.iface.SecurityContext;

/**
 * @author Jian Fang (John.Jian.Fang@gmail.com)
 *
 * Date: Jul 1, 2009
 */
public class ThreadLocalSecurityContextHolderImpl implements SecurityContextHolder {

    private static ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<SecurityContext>();

    public void clearContext() {
        contextHolder.set(null);
    }

    public SecurityContext getContext() {

        return contextHolder.get();
    }

    public void setContext(SecurityContext context) {
        contextHolder.set(context);
    }

}
